export default {
	async categoryTree() {
		let res = await this.httptool.post(this.apis.categoryTree, 1);
		let arr = [];
		for(let item of res.data) {
			if(item.id == 1 || item.id == 2) {
				arr = arr.concat(item.children)
			} else {
				arr.push(item);
			}
		}
		this.types = arr;
	},
	async latestPrice() {
		let res = await this.httptool.post('betaBrtWtiExcRateAPI/getAll', null);
		this.latestPrices = res.data;

	},
	async noticeNoticePage() {
		let res = await this.httptool.post('information/inforPage', this.pageParams);
		this.total = res.data.total;
		this.infoList = res.data.list.map(item => {
			if(item.articleContent) {
				item.articleContent = item.articleContent.replace(/<[^>]+>|&nbsp;/g, "");
				return item;
			}
		});
	},
	async getBanner() {
		let params = {
			bannerType: "outline_picture",
			pageNum: 1,
			pageSize: 10
		}
		let res = await this.httptool.post('bannerPicture/page', params);
		this.banner = res.data.list.map(item => {
			item.imgId = this.httptool.ftpUrl + 'view/' + item.imgId;
			return item;
		});
	}
}